Thuật toán Thuật_toán_Dinitz

Thuật toán Dinitz

Dữ liệu vào: Mạng G = ( ( V , E ) , c , s , t ) {\displaystyle G=((V,E),c,s,t)} .Dữ liệu ra: Một luồng f {\displaystyle f} từ s {\displaystyle s} đến t {\displaystyle t} có giá trị lớn nhất.
  1. Khởi tạo f ( e ) = 0 {\displaystyle f(e)=0} với mọi e ∈ E {\displaystyle e\in E} .
  2. Xây dựng G L {\displaystyle G_{L}} từ G f {\displaystyle G_{f}} của G {\displaystyle G} . Nếu dist ⁡ ( t ) = ∞ {\displaystyle \operatorname {dist} (t)=\infty } , thì dừng và đưa ra kết quả f {\displaystyle f} .
  3. Tìm luồng ngăn chặn f ′ {\displaystyle f'} trong G L {\displaystyle G_{L}} .
  4. Tăng luồng   f {\displaystyle \ f} bằng cách thêm f ′ {\displaystyle f'} và quay lại bước 2.